package com.liyy.platform.other.listener_event.listener;

import com.liyy.platform.other.listener_event.event.MyEvent;
import org.apache.log4j.Logger;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;

/**
 * Created by liyy on 2018/8/17.
 * 将监听器放入spring容器中
 */
@Component
public class MyListener2 implements ApplicationListener<MyEvent> {
    Logger logger = Logger.getLogger(MyListener2.class);

    public void onApplicationEvent(MyEvent event)
    {
        logger.info(String.format("%s监听到事件源：%s.", MyListener2.class.getName(), event.getSource()));
    }
}
